<template>
<view>
<view class="container font_08">
  <view class="orderSateContainer" v-if="!orderDetailData.processInstanceId&&orderDetailData.mendianZiti==0">
    <view class="oooo ">
      <image mode="aspectFill" src="https://image1.sansancloud.com/xianhua/2019_12/12/14/53/45_581.jpg?x-oss-process=style/preview_120"></image>
      <view class="oooo_view"> 
        <text class="font5">订单号: {{orderDetailData.orderNo}}</text>
        <text>订单金额: ￥{{orderDetailData.goodsAmount}}</text>
        <text>运费: ￥{{orderDetailData.yunfeiAmount}}</text>
        <text>{{orderDetailData.payTypeStr}}: ￥{{orderDetailData.payAmount}}</text>
        <block v-if="orderDetailData.payStatus == 0"> <text>支付状态: 未支付</text>  </block>
        <block v-if="orderDetailData.payStatus == 1"> <text>支付状态: 已支付</text>  </block>
        <block v-if="orderDetailData.payStatus == 2"> <text>支付状态: 已退款</text>  </block>
      </view>
    </view> 
  
    <block v-if="orderDetailData.easyStatusStr == '作废'"> 
      <text :style="'color:' + setting.platformSetting.defaultColor">已作废</text>
    </block>
    <block v-else-if="orderDetailData.easyStatusStr == '完成'"> 
      <text :style="'color:' + setting.platformSetting.defaultColor">交易成功</text>
    </block>
    <block v-else-if="orderDetailData.easyStatusStr == '待评价'"> 
      <text :style="'color:' + setting.platformSetting.defaultColor">待完成</text>
    </block>
    <block v-else>
        <text :style="'color:' + setting.platformSetting.defaultColor">{{orderDetailData.easyStatusStr}}</text> 
    </block>
  </view>
  <view class="orderKuaidi" v-if="orderDetailData.orderStatus > 3 && orderDetailData.orderStatus < 7&&orderDetailData.processInstanceId==0&& orderDetailData.mendianZiti==0">
      <view> 
         <text>快递名：</text> 
         <text :style="'color:' + setting.platformSetting.defaultColor">{{orderDetailData.kuaidiName}}</text> 
      </view>
      <view class="orderKuaidi_no">
        <text>快递单号：</text> 
        <text selectable="true" :style="'color:' + setting.platformSetting.defaultColor">{{orderDetailData.invoiceNo}}</text>
        <text v-if="orderDetailData.invoiceNo" style="padding:0 0.4em;border-radius:0.4em;color:#e24148; border:2rpx solid #e24148; margin-left:0.6em;" @click.stop="copyTBL" :data-value="orderDetailData.invoiceNo">复制</text>
        <text v-else style="padding:0 0.4em;border-radius:0.4em;color:#e24148; border:2rpx solid #e24148; margin-left:0.6em;"></text>
      </view>
  </view>
  <view v-if="orderDetailData.mendianZiti==0&&setting.platformSetting.addressType!=2">
    <view @tap="showOtherArr" class="editAddr" v-if="orderDetailData.orderStatus < 3"><!--  -->
      <view class="editAddr_text">修改收货地址</view>
      <image src="https://image1.sansancloud.com/xianhua/2019_12/12/13/50/4_17.jpg?x-oss-process=style/preview_120"></image>
    </view>
    <view class="addrItems2" v-if="orderDetailData.mendianZiti==0&&orderDetailData.hideUserAddress==0">
        <view class="addrItemsLeft">
          <image mode="aspectFill" class="addr_icon" src="https://image1.sansancloud.com/xianhua/2019_12/12/13/49/30_402.jpg?x-oss-process=style/preview_120"></image>
          <view class="addrInfo" @click.stop="copyTBL" :data-value="orderDetailData.buyerName + '' + orderDetailData.buyerTelno + '' + orderDetailData.buyerProvince + '' + orderDetailData.buyerCity + '' + orderDetailData.buyerArea + '' + (orderDetailData.buyerCommunity?orderDetailData.buyerCommunity:'') + '' + orderDetailData.buyerAddress + '' + orderDetailData.buyerIdCardNo">
            <view>
              <text>{{orderDetailData.buyerName}}</text>
              <text class="marginleft">{{orderDetailData.buyerTelno}}</text>
            </view>
            <text class="font2">{{orderDetailData.buyerProvince}} {{orderDetailData.buyerCity}} {{orderDetailData.buyerArea}} {{orderDetailData.buyerAddress}}</text>
          </view>
        </view>
        <view class="navigation" v-if="orderDetailData.buyerLatitude!=0&&orderDetailData.buyerLongitude!=0" :style="'border:1rpx solid ' + setting.platformSetting.defaultColor + ';color:' + setting.platformSetting.defaultColor" @click.stop="clickCatch" :data-info="orderDetailData"><text>去导航</text></view>
    </view>
  </view>
  <view v-if="orderDetailData.mendianZiti==1">
    <view class="editAddr">
      <view class="editAddr_text">自提门店：【{{orderDetailData.belongMendian.name}}】</view>
      <!-- <image src='https://image1.sansancloud.com/xianhua/2019_12/12/13/50/4_17.jpg?x-oss-process=style/preview_120'></image> -->
    </view>
    <view class="addrItems2" @click.stop="clickCatch" :data-info="orderDetailData.belongMendian">
      <view class="cardVoucher_ewm" v-if="orderDetailData.orderStatus<=3&&orderDetailData.payStatus==1">
        <image class="cardVoucher_ewm_img" :src="ewmCode"></image>
        <text style="font-size:30rpx;margin:10rpx 0">订单号：{{orderDetailData.orderNo}}</text>
        <text style="font-size:26rpx;color:#999">Tip:【请出示该小程序码核销】</text>
      </view>
       <view class="cardVoucher_ewm" v-else-if="orderDetailData.orderStatus>3&&orderDetailData.payStatus==1">
        <view class="successIcon"><icon type="success" size="40" :color="setting.platformSetting.defaultColor"></icon></view>
        <text style="font-size:30rpx;margin:10rpx 0">订单号：{{orderDetailData.orderNo}}</text>
        <text style="font-size:26rpx;color:#999">Tip:已发货成功</text>
      </view>
      <view class="cardVoucher_ewm" v-else-if="orderDetailData.payStatus==3">
          <!-- orderDetailData.orderStatus<=3&& -->
        <text style="font-size:30rpx;margin:10rpx 0">订单号：{{orderDetailData.orderNo}}</text>
        <text style="font-size:26rpx;color:#999;border:1rpx solid #eee;padding: 4rpx 10rpx;">您还没支付尾款~_~</text>
      </view>
      <view class="cardVoucher_ewm" v-else>
        <text style="font-size:30rpx;margin:10rpx 0">订单号：{{orderDetailData.orderNo}}</text>
        <text style="font-size:26rpx;color:#999">未支付</text>
      </view>
        <!-- <image mode="aspectFill" src='https://image1.sansancloud.com/xianhua/2019_12/12/13/49/30_402.jpg?x-oss-process=style/preview_120'></image>
        <view class='addrInfo'>
          <text>{{orderDetailData.belongMendian.telno}}</text>
          <text class='font2' wx:if="{{orderDetailData.belongMendian.address}}">{{orderDetailData.belongMendian.address}}</text>
          <text class='font2' wx:else>{{orderDetailData.belongMendian.province}}-{{orderDetailData.belongMendian.city}}</text>
        </view>
        <view class='check_info'>
          <text class='check_info_text'>去导航</text>
          <image class='check_info_icon' src='https://image1.sansancloud.com/xianhua/2019_1/14/14/5/10_367.jpg'></image>
        </view> -->
    </view>
  </view>
  <view class="mendian_container" @click.stop="clickCatch" :data-info="orderDetailData.belongMendian">
     <view class="server_container_left">
       <image class="storageIcon" src="https://image1.sansancloud.com/xianhua/2019_5/15/13/43/23_814.jpg?x-oss-process=style/preview"></image>
       <text>{{orderDetailData.storageName}}</text>
       </view>
     <view class="navigation" v-if="orderDetailData.belongMendian.latitude!=0&&orderDetailData.belongMendian.longitude!=0" :style="'border:1rpx solid ' + setting.platformSetting.defaultColor + ';color:' + setting.platformSetting.defaultColor"><text>去导航</text></view>
  </view>
  <!-- 服务人员 -->
  <view class="server_container" @click.stop="clickCatch" :data-info="orderDetailData.assignServant">
     <view class="server_container_left">
       <image class="storageIcon" src="https://image1.sansancloud.com/xianhua/2019_10/11/14/43/9_878.jpg?x-oss-process=style/preview_120"></image>
       <text style="margin-left:10rpx">业务员：</text>
       <text>{{orderDetailData.assignServant.name}}</text>
     </view>
     <view></view>
  </view>
  <view class="cartContainer">                        
    <view class="cartShopName">
      <text class="font1">{{orderDetailData.belongShopName}}</text>
      <text v-if="orderDetailData.promotionName" class="marginleft vity_tag">{{orderDetailData.promotionName}}</text>
      <view class="color" :style="'color:' + setting.platformSetting.defaultColor">
          合计:￥ {{orderDetailData.goodsAmount}}
          <text v-if="orderDetailData.prepayAmount>0">【预付￥{{orderDetailData.prepayAmount}}</text>
          <text v-if="orderDetailData.prepayAmount>0&&!orderDetailData.needJifen">】</text>
          <text v-if="!orderDetailData.prepayAmount&&orderDetailData.needJifen>0">【</text>
          <text v-if="orderDetailData.needJifen>0">+{{orderDetailData.needJifen}}积分】</text>
      </view>
    </view>
    <view class="cartItems" v-for="(orderItem, index) in orderDetailData.orderItems" :key="index" @click.stop="tolinkUrl" :data-info="orderItem" v-if="!orderItem.scanExhauseList||orderItem.scanExhauseList=='{}'">
      <view class="itemCheckbox">
        <image mode="aspectFill" :src="orderItem.itemIcon + '?x-oss-process=style/preview'"></image>
      </view>
      <view class="item_infomation">
        <view class="item_infomation_name">{{orderItem.itemName}}</view>
        <view class="item_infomation_name_measure" v-if="!!orderItem.measureCartesianId">{{orderItem.measures}}</view>
        <view class="item_infomation_nums"> 
          <text class="flexCenter">x {{orderItem.itemCount}}</text>
        </view>
        <view class="item_infomation_money" :style="'color:' + setting.platformSetting.defaultColor">单价:￥ {{orderItem.itemPrice}}</view>
      </view>
    </view>
    <!-- 核销列表 -->
    <view class="verification_block" v-if="allScanExhauseList.length!=0">
      <view class="verification_title">
        <view class="verification_title_item" style="width:30%">
          <text>套餐名称</text>
        </view>
        <view class="verification_title_item" style="width:50%">
          <text>套餐内容</text>
        </view>
        <view class="verification_title_item" style="width:20%">
          <text>套餐次数</text>
        </view>
      </view>
      <view class="verification_list">
        <view class="verification_item" v-for="(item, index) in allScanExhauseList" :key="index">
          <text class="verification_item_data" style="width:30%">{{item.name}}</text>
          <text class="verification_item_data" style="width:50%">{{item.remark}}</text>
          <text class="verification_item_data" style="width:20%">{{item.count}}次</text>
        </view>
      </view>
    </view>
    <!-- <view class='butn_container2'>
      <text>留言</text>
      <text class='Input'>{{orderDetailData.buyerScript}}</text>
    </view> -->
  </view>
<!-- 表单地址 -->
  <check-form-detail-component id="checkFormDetail" showTitle="false" showBtn="false" :formCommitId="formCommitId" v-if="formCommitId" @selectPsotion="selectPsotion"></check-form-detail-component>
  <!-- <process-instance-item v-if="orderDetailData.processInstanceId" :receiveData="orderDetailData.processInstance" showDetailBtn="false"></process-instance-item> -->
  <map class="mapItem" id="map" :longitude="orderDetailData.assignServant.longitude||0" :latitude="orderDetailData.assignServant.latitude||0" scale="14" @controltap="controltap" @regionchange="regionchange" show-location="true" style="width: 100%; height: 768rpx;" v-if="orderDetailData.assignServant">
    <cover-view class="play">
        <cover-image class="img" src="../../images/icon/center.png" style="width:80rpx;height:80rpx;"></cover-image>
    </cover-view>
  </map>
  <view class="orderTime">
    <text>订单生成时间: {{orderDetailData.addTime||''}}</text>
    <text>订单支付时间: {{orderDetailData.payTime||''}}</text>
    <text>订单送货时间: {{orderDetailData.receiveTime||''}}</text>
  </view>
  
  
   <view class="orderTime2" :style="orderDetailData.payStatus==3?'padding-bottom:100rpx;':'' ">
    <view class="wuliuItem" v-for="(item, index) in orderDetailData.kuaidiBean.data" :key="index">
      <view style="color:#333">{{item.context}}</view>
      <view class="time">{{item.time}} </view>
    </view>
  </view> 

  
</view>
<block v-if="showArr">
  <view class="zhezhao" @tap="closeShowArr"></view>
  <view scroll-y style="height:100%" class="OtherArrContainer">
    <view class="addnewarr" @tap="toaddress_newFun" :style="'color:' + setting.platformSetting.defaultColor">
      <text>新增地址</text>
    </view>
    <view class="addrItems2_now" v-for="(addr, index) in addrArr" :key="index" :data-index="index" @tap="chooseNewAddr">
        <image mode="aspectFit" src="https://image1.sansancloud.com/xianhua/2019_12/12/13/49/30_402.jpg?x-oss-process=style/preview_120"></image>
        <view class>
          <text>{{addr.contactName}} {{addr.telNo}}</text>
          <text class="font2">{{addr.province}} {{addr.city}} {{addr.area}} {{addr.address}}</text>
        </view>
      </view>
  </view>
</block>
<block v-if="orderDetailData.payStatus==3">
    <view class="prepay_block" :style="'background:' + setting.platformSetting.defaultColor" @tap="payFinalPaymentFun()">
        支付尾款￥{{orderDetailData.remainAmount}}
    </view>
</block>
</view>
</template>

<script>
// import checkFormDetail from "../../view/partials/check_form_detail/index";
// import processInstanceItem from "../../view/partials/processInstanceItemTwo/index";

export default {
  data() {
    return {
      setting: null,
      loginUser: null,
      formCommitId: null,
      orderNo: null,
      orderDetailData: null,
      showArr: false,
      addrArr: null,
      hasAddnewAddr: false,
      ewmCode: "",
      allScanExhauseList: [],
      params: ""
    };
  },

  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (o) {
    var that = this;
    this.setData({
      setting: getApp().globalData.setting
    });
    this.setData({
      loginUser: getApp().globalData.loginUser
    });
    console.log(o);

    if (!!o.orderNo) {
      this.orderNo = o.orderNo;
      this.setData({
        orderNo: this.orderNo
      });
      that.getOrderDetail(o.orderNo);
      that.timer = setInterval(function () {
        console.log("===========timer get order detail============");

        if (!that.orderDetailData || that.orderDetailData.payStatus == 1 && that.orderDetailData.orderStatus <= 3) {
          that.getOrderDetail(o.orderNo);
        } else {
          clearInterval(that.timer);
        }
      }, 8000);
    } else {
      wx.navigateBack();
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    if (this.hasAddnewAddr) {
      this.showOtherArr();
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    clearInterval(this.timer);
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    clearInterval(this.timer);
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},
  methods: {
    //支付尾款
    payFinalPaymentFun: function () {
        let that = this;
        let loginUser = getApp().globalData.loginUser;
        let orderItem = that.orderDetailData;
        console.log(loginUser);
        let wxChatPayParam = {
          openid: loginUser.platformUser.miniOpenId,
          orderNo: orderItem.orderNo,
          app: 3
        };
        console.log(wxChatPayParam);
        getApp().globalData.payFinalPaymentFun(orderItem,wxChatPayParam,function(res){
            console.log("==payFinalPaymentFun==res",res)
              setTimeout(function () {
                that.getOrderDetail(that.orderNo)
              }, 1000);
        })
    },
    tolinkUrl: function (e) {
      console.log(e.currentTarget.dataset.info); // product_detail.html?productId= 9219;

      let productData = e.currentTarget.dataset.info;
      let link = "";

      if (productData.productType == 6) {
        link = "ticket_detail.html?productId=" + productData.itemId;
      } else {
        link = "product_detail.html?productId=" + productData.itemId;
      } // var a = "product_detail.html?productId=" + e.currentTarget.dataset.id; 


      getApp().globalData.linkEvent(link);
    },
    clickCatch: function (e) {
      console.log(e.currentTarget.dataset.info);
      let info = e.currentTarget.dataset.info;
      console.log(info);
      let latitude = info.latitude || info.buyerLatitude;
      let longitude = info.longitude || info.buyerLongitude;
      let name = info.name || info.buyerName || info.belongShopName;
      let address = info.address || info.buyerProvince + info.buyerCity + info.buyerArea + info.buyerAddress; // 判断金纬度是否为空

      if (latitude == 0 || longitude == 0) {
        console.log("判断金纬度是否为空");
        wx.showModal({
          title: '提示',
          content: '主人~该门店没有设置位置哦!',
          success: function (res) {
            if (res.confirm) {
              console.log('用户点击确定');
            } else if (res.cancel) {
              console.log('用户点击取消');
            }
          }
        });
        return;
      } else {
        wx.openLocation({
          latitude: latitude,
          longitude: longitude,
          scale: 12,
          name: name,
          address: address
        });
      }
    },

    /* 获取地址列表 */
    showOtherArr: function () {
      var customIndex = getApp().globalData.AddClientUrl("/get_login_user_address_list.html");
      var that = this; // wx.showLoading({
      //   title: 'loading'
      // })

      getApp().globalData.showToastLoading('loading', true);
      wx.request({
        url: customIndex.url,
        header: getApp().globalData.header,
        success: function (res) {
          console.log(res.data);
          wx.hideLoading();
          that.setData({
            addrArr: res.data.result,
            showArr: true
          });
        },
        fail: function (res) {
          wx.hideLoading();
          getApp().globalData.loadFail();
        }
      });
    },
    chooseNewAddr: function (e) {
      getApp().globalData.showToastLoading('loading', true);
      let that = this;
      var addrArr = this.addrArr;
      var index = e.currentTarget.dataset.index;
      var selectAddr = addrArr[index];
      console.log(selectAddr);
      let addrParam = {};
      addrParam.addressId = selectAddr.id;
      addrParam.orderNo = this.orderDetailData.orderNo;
      let customIndex = getApp().globalData.AddClientUrl("/change_order_address.html", addrParam, 'post');
      wx.request({
        url: customIndex.url,
        data: customIndex.params,
        header: getApp().globalData.headerPost,
        method: 'POST',
        success: function (res) {
          console.log(res.data);

          if (res.data.errcode == 0) {
            let orderDetailData = that.orderDetailData;
            orderDetailData.buyerName = selectAddr.contactName;
            orderDetailData.buyerTelno = selectAddr.telNo;
            orderDetailData.buyerProvince = selectAddr.province;
            orderDetailData.buyerCity = selectAddr.city;
            orderDetailData.buyerArea = selectAddr.area;
            orderDetailData.buyerAddress = selectAddr.address;
            that.setData({
              orderDetailData: orderDetailData,
              showArr: false
            });
            wx.showToast({
              title: '地址修改成功'
            });
          }
        },
        fail: function (res) {
          getApp().globalData.loadFail();
        }
      });
      wx.hideLoading();
    },
    closeShowArr: function () {
      this.setData({
        showArr: false
      });
    },
    toaddress_newFun: function () {
      this.setData({
        hasAddnewAddr: true
      });
      wx.navigateTo({
        url: '/pages/add_address/index'
      });
    },
    getVerificationCode: function (orderItem) {
      var that = this;
      let params = {
        verifyScanType: 2,
        code: orderItem.orderNo || 0
      };
      var customIndex = getApp().globalData.AddClientUrl("/wx_get_scan_verify_parameter.html", params);
      wx.request({
        url: customIndex.url,
        header: getApp().globalData.header,
        success: function (res) {
          console.log("getVerificationCode", res.data);

          if (res.data.errcode == 0) {
            that.getEwmCode(res.data.relateObj);
          } else {
            if(orderItem.payStatus!=3){
                wx.showModal({
                  title: '错误',
                  content: res.data.errMsg,
                  success: function (res) {
                    if (res.confirm) {
                      console.log('用户点击确定');
                      wx.navigateBack({
                        delta: 1
                      });
                    } else if (res.cancel) {
                      console.log('用户点击取消');
                      wx.navigateBack({
                        delta: 1
                      });
                    }
                  }
                });
            }
          }
        },
        complete: function (res) {}
      });
    },
    getEwmCode: function (data) {
      let that = this;
      let userId = "";

      if (getApp().globalData.loginUser && getApp().globalData.loginUser.platformUser) {
        userId = 'MINI_PLATFORM_USER_ID_' + getApp().globalData.loginUser.platformUser.id;
      } // + "%26verifyScanType%3d" + that.onloadOpt.verifyScanType + "%26sign%3d" + data.sign + "%26seq%3d" + data.seq + "%26scene%3d" + userId 


      let getUrl = getApp().globalData.AddClientUrl("/super_shop_manager_get_mini_code.html");
      that.setData({
        ewmCode: getUrl.url + '&path=pageTab%2findex%2findex%3fVERIFICATION_CODE%3d' + data.verifyScanCode + "%26verifyScanType%3d" + data.verifyScanType + "%26sign%3d" + data.sign
      });
      console.log("ewmCode", that.ewmCode);
    },
    getOrderDetail: function (id) {
      let that = this;
      let getParams = {};
      getParams.orderNo = id;
      let customIndex = getApp().globalData.AddClientUrl("/get_order_detail.html", getParams);
      /*wx.showLoading({
        title: 'loading'
      })*/

      wx.request({
        url: customIndex.url,
        header: getApp().globalData.header,
        success: function (res) {
          console.log('-----------orderDetail--------', res.data);
          let orderDetailData = res.data;
          orderDetailData.remainAmount=(orderDetailData.goodsAmount - orderDetailData.youhuiAmount - orderDetailData.payAmount).toFixed(2)
          that.allScanExhauseList = [];
          let allScanExhauseList = that.allScanExhauseList;

          if (orderDetailData.orderItems.length != 0) {
            for (let i = 0; i < orderDetailData.orderItems.length; i++) {
              if (orderDetailData.orderItems[i].scanExhauseList && orderDetailData.orderItems[i].scanExhauseList != '{}') {
                let scanExhauseListData = JSON.parse(orderDetailData.orderItems[i].scanExhauseList).items;
                console.log("====scanExhauseListData====", scanExhauseListData); // allScanExhauseList.concat(scanExhauseListData);

                allScanExhauseList.push(...scanExhauseListData);
                console.log("====allScanExhauseList====", allScanExhauseList);
              }
            }

            that.setData({
              allScanExhauseList: allScanExhauseList
            });
          }

          console.log("===allScanExhauseList===", allScanExhauseList);
          that.setData({
            orderDetailData: orderDetailData
          });

          if (res.data.mendianZiti == 1) {
            that.getVerificationCode(res.data);
          }

          if (res.data.processInstanceId) {
            that.getProcessList(res.data.processInstanceId);
          }

          if (res.data.userAddressCustomFormCommitId) {
            that.setData({
              formCommitId: res.data.userAddressCustomFormCommitId
            });
          }

          wx.hideLoading();
        },
        fail: function (res) {
          wx.hideLoading();
          getApp().globalData.loadFail();
        }
      });
    },

    // 地图
    regionchange(e) {
      console.log('===regionchange===', e);

      if (e.type == 'end') {
        if (e.causedBy == 'scale') {
          console.log('====scale====');
        } else if (e.causedBy == 'drag') {
          console.log('====drag====');
          this.getCenterPoint(this.getData);
        } else {
          console.log('====all====');
          this.getCenterPoint(this.getData);
        }
      }
    },

    getCenterPoint(callback) {
      let that = this;
      var mapCtx = wx.createMapContext('map');
      mapCtx.getCenterLocation({
        success: function (res) {
          console.log('res', res);
          let params = {}; // that.getLoctionAddr(res.longitude, res.latitude)

          params.latitude = res.latitude;
          params.longitude = res.longitude;
          console.log("params", params);
          that.setData({
            params: params
          });

          if (callback) {
            callback(params, 2);
          }
        }
      }); //获取当前地图的中心经纬度
    },

    /* 获取数据 */
    getProcessList: function (id) {
      let that = this;
      if (!getApp().globalData.checkIfLogin()) return;
      let getParams = {};
      /* wx.showToast({
         title: '加载中...',
         icon: 'loading',
       })*/

      getParams.instanceStatus = 1;
      getParams.processId = id;
      let customIndex = getApp().globalData.AddClientUrl("/wx_get_process_instance_list.html", getParams);
      wx.request({
        url: customIndex.url,
        header: getApp().globalData.header,
        success: function (res) {
          console.log('====getProcessList-res===', res);
          let data = res.data;

          if (typeof res.data == 'string') {
            data = JSON.parse(res.data);
          }

          if (data.errcode == 0) {}
        },
        complete: function (res) {}
      });
    },
    //物流单号 一键复制的事件
    copyTBL: function (e) {
      var that = this;
      console.log("====copyTBL====", e);
      let value = e.currentTarget.dataset.value;
      wx.setClipboardData({
        data: value,
        success: function (res) {
          wx.getClipboardData({
            success: function (res) {
              wx.showToast({
                title: '复制成功',
                icon: 'success',
                duration: 2000
              });
            }
          });
        }
      });
    },
    setData: function (obj) {
      let that = this;
      let keys = [];
      let val, data;
      Object.keys(obj).forEach(function (key) {
        keys = key.split('.');
        val = obj[key];
        data = that.$data;
        keys.forEach(function (key2, index) {
          if (index + 1 == keys.length) {
            that.$set(data, key2, val);
          } else {
            if (!data[key2]) {
              that.$set(data, key2, {});
            }
          }

          data = data[key2];
        });
      });
    }
  }
};
</script>
<style>
@import "./index.css";
</style>